package com.jiecao.news.jiecaonews.backgroung;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import org.jsoup.helper.StringUtil;

import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;

import com.jiecao.news.jiecaonews.dao.NewsDao;
import com.jiecao.news.jiecaonews.util.SharedPreferencesUtil;
/**
 * 分享反馈
 * @author lidongwei
 *
 */
public class ShareTask  extends AsyncTask<String, String, Void> {
	private static final String TAG = "ShareTask";
	private String mUrl;
	public ShareTask(String url,long aId,String plt,String sns){
		mUrl = url+"?art_id="+aId+"&plt="+plt+"&sns="+sns;
	}

	@Override
	protected Void doInBackground(String... params) {
		try {
			feedShareInfo(mUrl);
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return null ;
	}

	private void feedShareInfo(String url) throws IOException {
		URL target = new URL(url);
		HttpURLConnection conn = (HttpURLConnection) target.openConnection();
		conn.setDoOutput(true);
		conn.setDoInput(true);
		conn.setRequestMethod("GET");
		conn.setRequestProperty("Content-Type", "text/html");
		conn.setRequestProperty("Accept", "text/html");
		conn.setConnectTimeout(5000);//设置5秒超时
		conn.connect();
		int code = conn.getResponseCode();
		System.out.println("code:" + code);
	}
}
